package com.richie696.dao;

import com.richie696.domain.OrderInfo;
import org.apache.ibatis.annotations.CacheNamespace;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.mybatis.caches.redis.RedisCache;

import java.util.List;

@CacheNamespace(implementation = RedisCache.class)
public interface OrderDAO {

    @Select("select * from `order_info` where `user_id` = #{userId}")
    @Results({
            @Result(property = "id", column = "id", id = true),
            @Result(property = "name", column = "name"),
            @Result(property = "orderId", column = "order_id"),
            @Result(property = "userId", column = "user_id"),
    })
    List<OrderInfo> findOrdersByUserId(Long userId);
}
